home *** CD-ROM | disk | FTP | other *** search
- Path: news.unt.edu!news
- From: Steve Fogoros <sfogoros@hsc.unt.edu>
- Newsgroups: comp.lang.c
- Subject: Re: Urgent: pow() in TurboC
- Date: Sun, 17 Mar 1996 10:19:57 -0800
- Organization: University of North Texas Health Science Center
- Message-ID: <314C57CD.3C17@hsc.unt.edu>
- References: <4igsu5$q1t@hatathli.csulb.edu>
- NNTP-Posting-Host: sfogoros.hsc.unt.edu
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (Win16; I)
-
- David Cho wrote:
- >
- > void main() {
- >
- > long int k;
- >
- > k = pow(2,23);
- >
- > }
- >
- > When I try this, k gets 0.0. Then I try smaller numbers like (2,3) and I
- > still get 0.0. So I change the parameters to (2.0, 3.0) and I get
- > 255.00. What is going on here?
- >
- > Is there a bug in the compiler? Please e-mail me.
-
- No bug, pow returns a double not int. Don't forget to include math.h or it still
- won't work right.
-
- --
- Steve Fogoros, Academic Information Coordinator
- University of North Texas Health Science Center
- sfogoros@hsc.unt.edu
-